﻿using System;
using System.IO;
using System.Windows.Markup;
using System.Xml;
using System.Windows;

namespace Stema.Utils
{
 internal static class XamlHelper
 {
  internal static Object CloneUsingXaml(Object o)
  {
   if (o == null)
    return null;

   if (o is DependencyObject)
   {
    string xaml = XamlWriter.Save(o);
    return XamlReader.Load(new XmlTextReader(new StringReader(xaml)));
   }
   return o;
  }
 }
}
